
from marshmallow import fields, validate
from applications.extensions import ma

class TitleInSchema(ma.Schema):
    parentId = fields.Integer()
    titleName = fields.Str(required=True)
    status = fields.Str(validate=validate.OneOf(["0", "1"]))
    sort = fields.Integer()

class TitleOutSchema(ma.Schema):
    titleId = fields.Integer(attribute="id")
    parentId = fields.Integer(attribute="parent_id")
    titleName = fields.Str(attribute="title_name")
    status = fields.Str(validate=validate.OneOf(["0", "1"]))
    sort = fields.Integer()